home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / SciAn / src / ScianMethods.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  161 lines

  1.  
  2. /* ScianMethods.c:    John R. Murray, 3-30-90
  3.         Wrappers for Method calls.
  4. */
  5. #include "Scian.h"
  6. #include "ScianTypes.h"
  7. #include "ScianIDs.h"
  8. #include "ScianMethods.h"
  9. #include "ScianWindows.h"
  10. #include "ScianScripts.h"
  11.  
  12. /* globals */
  13.  
  14. /* temporary defs to get something going */
  15. #ifndef SETVAL
  16. #define SETVAL 102
  17. #endif
  18.  
  19. int SetValue(object, value)
  20. ObjPtr    object, value;    
  21. {
  22.     FuncTyp setter, changer;
  23.     ObjPtr retVal;
  24.  
  25.     setter = GetMethod(object, SETVAL);
  26.     if (setter)
  27.     {
  28.     retVal = (* setter) (object, value);
  29.     }
  30.     else
  31.     {
  32.     /* all objects SHOULD have a SETVAL method */
  33.     ReportError("SetValue", "Warning: no SETVAL method");
  34.     retVal = SetObjValue(object, value);
  35.     }
  36.  
  37.     return IsTrue(retVal);
  38. }
  39.  
  40. ObjPtr GetValue(obj)
  41. ObjPtr obj;
  42. {
  43.     FuncTyp getter;
  44.  
  45.     getter = GetMethod(obj, GETVAL);
  46.     if (getter)
  47.     {
  48.     return (*getter) (obj);
  49.     }
  50.     else
  51.     {
  52.     /* all objects SHOULD have a GETVAL method */
  53.     ReportError("GetValue", "Warning: no GETVAL method");
  54.     return GetObjValue(obj);
  55.     }
  56. }
  57.  
  58. int ChangedValue(object)
  59. ObjPtr    object;
  60. {
  61.     FuncTyp    changer;
  62.     int        retVal;
  63.  
  64.     changer = GetMethod(object, CHANGEDVALUE);
  65.     if(changer)
  66.     {
  67.     InhibitLogging(true);
  68.     retVal = IsTrue((* changer) (object));
  69.     InhibitLogging(false);
  70.     return retVal;
  71.     }
  72.     else
  73.     {
  74.     return false;
  75.     }
  76. }
  77.  
  78. int RecalcScroll(obj)
  79. ObjPtr obj;
  80. {
  81.     FuncTyp    recalcer;
  82.  
  83.     recalcer = GetMethod(obj, RECALCSCROLL);
  84.     if (recalcer)
  85.     {
  86.     return IsTrue((* recalcer) (obj));
  87.     }
  88.     else
  89.     {
  90.     return false;
  91.     }
  92. }
  93.  
  94. #ifdef PROTO
  95. ObjPtr CloneObject(ObjPtr obj)
  96. #else
  97. ObjPtr CloneObject(obj)
  98. ObjPtr obj;
  99. #endif
  100. {
  101.     FuncTyp method;
  102.  
  103.     method = GetMethod(obj, CLONE);
  104.     if (method)
  105.     {
  106.     return (* method)(obj);
  107.     }
  108.     else
  109.     {
  110.     return Clone(obj);
  111.     }
  112. }
  113.  
  114. int ButtonPressed(obj)
  115. ObjPtr obj;
  116. {
  117.     FuncTyp buttpress;
  118.  
  119.     buttpress = GetMethod(obj, BUTTONPRESSED);
  120.     if (buttpress)    /* I don't get it, what's so funny? */
  121.     {
  122.     return IsTrue((* buttpress) (obj));    /* am I missing something? */
  123.     }
  124.     else
  125.     {
  126.     return false;
  127.     }
  128. }
  129.  
  130. int Mark(obj)
  131. ObjPtr obj;
  132. {
  133.     FuncTyp marker;
  134.  
  135.     marker = GetMethod(obj, MARK);
  136.     if (marker)
  137.     {
  138.     return IsTrue((* marker) (obj));
  139.     }
  140.     else
  141.     {
  142.     return false;
  143.     }
  144. }
  145.  
  146. int AutoScroll(obj)
  147. ObjPtr obj;
  148. {
  149.     FuncTyp autoScroller;
  150.  
  151.     autoScroller = GetMethod(obj, AUTOSCROLL);
  152.     if (autoScroller)
  153.     {
  154.     return IsTrue((* autoScroller) (obj));
  155.     }
  156.     else
  157.    {
  158.     return false;
  159.    }
  160. }
  161.